<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue-router/3.4.8/vue-router.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.0/axios.min.js"></script>
</head>

<body>
    <div id='app'>
        <router-link :to="{path:'/login',query:{courseId:103}}">
            <!-- <ul>
                <li v-for="(item,index) in ">

                </li>
            </ul> -->
            跳转
        </router-link>>
        <router-view></router-view>
    </div>
    <template id="demo">
        <div>
            我是首页
        </div>
    </template>
    <template id="demo2">
        <div>
            我是跳转页
        </div>
    </template>
    <script>
        let login1 = {
            template: "#demo",

        }
        // 组件注册
        let login2 = {
            template: "#demo2",
            created() {
                console.log(111);
                console.log(this.$route);
                console.log(this.$route.query);
                console.log(this.$route.query.courseId);
            }
        }
    </script>
    <script>
        // 路由实例化
        let router = new VueRouter({
            routes: [
                {
                    path: "/",
                    component: login1
                },
                {
                    path: "/login",
                    component: login2
                }
            ]
        })
        // vue是劣化
        const vm = new Vue({
            el: '#app',
            data: {
            },
            router,
            // created() {
            //     axios.get("http://59.111.104.104:8086/pc/course/detail/{courseId}").then((res) => {

            //     })
            // }

        })
    </script>
</body>

</html>